{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2023-05-09T15:31:27.798276500Z",
     "start_time": "2023-05-09T15:31:27.692276900Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [],
   "source": [
    "class Encoder:\n",
    "    def __init__(self, vocab_size, wordvec_size, hidden_size):\n",
    "        V, D, H = vocab_size, wordvec_size, hidden_size\n",
    "        rn = np.random.randn\n",
    "\n",
    "        embed_W = (rn(V, D) / 100).astype('f')\n",
    "        lstm_Wx = (rn(D, 4 * H) / np.sqrt(D)).astype('f')\n",
    "        lstm_Wh = (rn(H, 4 * H) / np.sqrt(H)).astype('f')\n",
    "        lstm_b = np.zeros(4 * H).astype('f')\n",
    "\n",
    "        self.embed = TimeEmbedding(embed_W)\n",
    "        self.lstm = TimeLSTM(lstm_Wx, lstm_Wh, lstm_b, stateful=False)\n",
    "\n",
    "        self.params = self.embed.params + self.lstm.params\n",
    "        self.grads = self.embed.grads + self.lstm.grads\n",
    "        self.hs = None\n",
    "\n",
    "    def forward(self, xs):\n",
    "        xs = self.embed.forward(xs)\n",
    "        hs = self.lstm.forward(xs)\n",
    "        self.hs = hs\n",
    "        return hs[:, -1, :]\n",
    "\n",
    "    def backward(self, dh):\n",
    "        dhs = np.zeros_like(self.hs)\n",
    "        dhs[:, -1, :] = dh\n",
    "        dout = self.lstm.backward(dhs)\n",
    "        dout = self.embed.backward(dout)\n",
    "        return dout"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:13:48.700604600Z",
     "start_time": "2023-05-09T16:13:48.691605800Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [],
   "source": [
    "class Decoder:\n",
    "    def __init__(self, vocab_size, wordvec_size, hidden_size):\n",
    "        V, D, H = vocab_size, wordvec_size, hidden_size\n",
    "        rn = np.random.randn\n",
    "        embed_W = (rn(V, D) / 100).astype('f')\n",
    "        lstm_Wx = (rn(D, 4 * H) / np.sqrt(D)).astype('f')\n",
    "        lstm_Wh = (rn(H, 4 * H) / np.sqrt(H)).astype('f')\n",
    "        lstm_b = np.zeros(4 * H).astype('f')\n",
    "        affine_W = (rn(H, V) / np.sqrt(H)).astype('f')\n",
    "        affine_b = np.zeros(V).astype('f')\n",
    "\n",
    "        self.embed = TimeEmbedding(embed_W)\n",
    "        self.lstm = TimeLSTM(lstm_Wx, lstm_Wh, lstm_b, stateful=True)\n",
    "        self.affine = TimeAffine(affine_W, affine_b)\n",
    "        self.params, self.grads = [], []\n",
    "        for layer in (self.embed, self.lstm, self.affine):\n",
    "            self.params += layer.params\n",
    "            self.grads += layer.grads\n",
    "\n",
    "    def forward(self, xs, h):\n",
    "        self.lstm.set_state(h)\n",
    "        out = self.embed.forward(xs)\n",
    "        out = self.lstm.forward(out)\n",
    "        score = self.affine.forward(out)\n",
    "        return score\n",
    "\n",
    "    def backward(self, dscore):\n",
    "        dout = self.affine.backward(dscore)\n",
    "        dout = self.lstm.backward(dout)\n",
    "        dout = self.embed.backward(dout)\n",
    "        dh = self.lstm.dh\n",
    "        return dh\n",
    "\n",
    "    def generate(self, h, start_id, sample_size):\n",
    "        sampled = []\n",
    "        sample_id = start_id\n",
    "        self.lstm.set_state(h)\n",
    "\n",
    "        for _ in range(sample_size):\n",
    "            x = np.array(sample_id).reshape((1, 1))\n",
    "            out = self.embed.forward(x)\n",
    "            out = self.lstm.forward(out)\n",
    "            score = self.affine.forward(out)\n",
    "            sample_id = np.argmax(score.flatten())\n",
    "            sampled.append(int(sample_id))\n",
    "        return sampled"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:29:15.997753Z",
     "start_time": "2023-05-09T16:29:15.976759Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "\"\"\"\n",
    "这个 generate() 方法有 3 个参数，分别是从编码器接收的隐藏状态 h、最开始输入的字符 ID start_id 和生成的字符数量 sample_size。这里重复如下操作：输入一个字符，选择 Affine 层输出的得分中最大值的字符 ID。以上就是 Decoder 类的实现\n",
    "\"\"\""
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [],
   "source": [
    "import sys\n",
    "\n",
    "sys.path.append('..')\n",
    "from common.time_layers import *\n",
    "from common.np import *\n",
    "from common.base_model import BaseModel"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:42:46.182390900Z",
     "start_time": "2023-05-09T16:42:46.160391700Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [],
   "source": [
    "class Seq2seq(BaseModel):\n",
    "    def __init__(self, vocab_size, wordvec_size, hidden_size):\n",
    "        V, D, H = vocab_size, wordvec_size, hidden_size\n",
    "        self.encoder = Encoder(V, D, H)\n",
    "        self.decoder = Decoder(V, D, H)\n",
    "        self.softmax = TimeSoftmaxWithLoss()\n",
    "        self.params = self.encoder.params + self.decoder.params\n",
    "        self.grads = self.encoder.grads + self.decoder.grads\n",
    "\n",
    "    def forward(self, xs, ts):\n",
    "        decoder_xs, decoder_ts = ts[:, :-1], ts[:, 1:]\n",
    "        h = self.encoder.forward(xs)\n",
    "        score = self.decoder.forward(decoder_xs, h)\n",
    "        loss = self.softmax.forward(score, decoder_ts)\n",
    "        return loss\n",
    "\n",
    "    def backward(self, dout=1):\n",
    "        dout = self.softmax.backward(dout)\n",
    "        dh = self.decoder.backward(dout)\n",
    "        dout = self.encoder.backward(dh)\n",
    "        return dout\n",
    "\n",
    "    def generate(self, xs, start_id, sample_size):\n",
    "        h = self.encoder.forward(xs)\n",
    "        sampled = self.decoder.generate(h, start_id, sample_size)\n",
    "        return sampled"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:42:47.900576100Z",
     "start_time": "2023-05-09T16:42:47.888566300Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [],
   "source": [
    "import sys\n",
    "\n",
    "sys.path.append('..')\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from dataset import sequence\n",
    "from common.optimizer import Adam\n",
    "from common.trainer import Trainer\n",
    "from common.util import eval_seq2seq"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:52:09.204839100Z",
     "start_time": "2023-05-09T16:52:08.614842500Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [],
   "source": [
    "# 读入数据集\n",
    "(x_train, t_train), (x_test, t_test) = sequence.load_data('addition.txt')\n",
    "char_to_id, id_to_char = sequence.get_vocab()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:52:18.074806300Z",
     "start_time": "2023-05-09T16:52:17.866806400Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [],
   "source": [
    "# 设定超参数\n",
    "vocab_size = len(char_to_id)\n",
    "wordvec_size = 16\n",
    "hidden_size = 128\n",
    "batch_size = 128\n",
    "max_epoch = 25\n",
    "max_grad = 5.0"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:52:32.441358400Z",
     "start_time": "2023-05-09T16:52:32.435358800Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [],
   "source": [
    "# 生成模型/优化器/训练器\n",
    "model = Seq2seq(vocab_size, wordvec_size, hidden_size)\n",
    "optimizer = Adam()\n",
    "trainer = Trainer(model, optimizer)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T16:52:42.471483900Z",
     "start_time": "2023-05-09T16:52:42.455483700Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "| epoch 1 |  iter 1 / 351 | time 0[s] | loss 2.56\n",
      "| epoch 1 |  iter 21 / 351 | time 0[s] | loss 2.53\n",
      "| epoch 1 |  iter 41 / 351 | time 0[s] | loss 2.17\n",
      "| epoch 1 |  iter 61 / 351 | time 1[s] | loss 1.96\n",
      "| epoch 1 |  iter 81 / 351 | time 1[s] | loss 1.92\n",
      "| epoch 1 |  iter 101 / 351 | time 2[s] | loss 1.87\n",
      "| epoch 1 |  iter 121 / 351 | time 2[s] | loss 1.85\n",
      "| epoch 1 |  iter 141 / 351 | time 3[s] | loss 1.83\n",
      "| epoch 1 |  iter 161 / 351 | time 3[s] | loss 1.79\n",
      "| epoch 1 |  iter 181 / 351 | time 4[s] | loss 1.77\n",
      "| epoch 1 |  iter 201 / 351 | time 4[s] | loss 1.77\n",
      "| epoch 1 |  iter 221 / 351 | time 4[s] | loss 1.76\n",
      "| epoch 1 |  iter 241 / 351 | time 5[s] | loss 1.76\n",
      "| epoch 1 |  iter 261 / 351 | time 5[s] | loss 1.76\n",
      "| epoch 1 |  iter 281 / 351 | time 6[s] | loss 1.75\n",
      "| epoch 1 |  iter 301 / 351 | time 6[s] | loss 1.74\n",
      "| epoch 1 |  iter 321 / 351 | time 7[s] | loss 1.75\n",
      "| epoch 1 |  iter 341 / 351 | time 7[s] | loss 1.74\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 100 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1000\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 1000\n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 100 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 1000\n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 1000\n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1000\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1000\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 1000\n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 100 \n",
      "---\n",
      "val acc 0.180%\n",
      "| epoch 2 |  iter 1 / 351 | time 0[s] | loss 1.74\n",
      "| epoch 2 |  iter 21 / 351 | time 0[s] | loss 1.73\n",
      "| epoch 2 |  iter 41 / 351 | time 0[s] | loss 1.74\n",
      "| epoch 2 |  iter 61 / 351 | time 1[s] | loss 1.74\n",
      "| epoch 2 |  iter 81 / 351 | time 1[s] | loss 1.73\n",
      "| epoch 2 |  iter 101 / 351 | time 2[s] | loss 1.73\n",
      "| epoch 2 |  iter 121 / 351 | time 2[s] | loss 1.72\n",
      "| epoch 2 |  iter 141 / 351 | time 3[s] | loss 1.71\n",
      "| epoch 2 |  iter 161 / 351 | time 3[s] | loss 1.71\n",
      "| epoch 2 |  iter 181 / 351 | time 4[s] | loss 1.71\n",
      "| epoch 2 |  iter 201 / 351 | time 4[s] | loss 1.70\n",
      "| epoch 2 |  iter 221 / 351 | time 5[s] | loss 1.71\n",
      "| epoch 2 |  iter 241 / 351 | time 5[s] | loss 1.70\n",
      "| epoch 2 |  iter 261 / 351 | time 6[s] | loss 1.69\n",
      "| epoch 2 |  iter 281 / 351 | time 6[s] | loss 1.69\n",
      "| epoch 2 |  iter 301 / 351 | time 7[s] | loss 1.69\n",
      "| epoch 2 |  iter 321 / 351 | time 7[s] | loss 1.68\n",
      "| epoch 2 |  iter 341 / 351 | time 8[s] | loss 1.67\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 994 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1000\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 700 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 100 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 400 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 1000\n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1000\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1544\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 400 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 400 \n",
      "---\n",
      "val acc 0.220%\n",
      "| epoch 3 |  iter 1 / 351 | time 0[s] | loss 1.66\n",
      "| epoch 3 |  iter 21 / 351 | time 0[s] | loss 1.66\n",
      "| epoch 3 |  iter 41 / 351 | time 0[s] | loss 1.65\n",
      "| epoch 3 |  iter 61 / 351 | time 1[s] | loss 1.63\n",
      "| epoch 3 |  iter 81 / 351 | time 1[s] | loss 1.62\n",
      "| epoch 3 |  iter 101 / 351 | time 2[s] | loss 1.62\n",
      "| epoch 3 |  iter 121 / 351 | time 2[s] | loss 1.60\n",
      "| epoch 3 |  iter 141 / 351 | time 3[s] | loss 1.59\n",
      "| epoch 3 |  iter 161 / 351 | time 3[s] | loss 1.57\n",
      "| epoch 3 |  iter 181 / 351 | time 4[s] | loss 1.57\n",
      "| epoch 3 |  iter 201 / 351 | time 4[s] | loss 1.56\n",
      "| epoch 3 |  iter 221 / 351 | time 5[s] | loss 1.54\n",
      "| epoch 3 |  iter 241 / 351 | time 5[s] | loss 1.52\n",
      "| epoch 3 |  iter 261 / 351 | time 6[s] | loss 1.52\n",
      "| epoch 3 |  iter 281 / 351 | time 6[s] | loss 1.52\n",
      "| epoch 3 |  iter 301 / 351 | time 7[s] | loss 1.50\n",
      "| epoch 3 |  iter 321 / 351 | time 7[s] | loss 1.49\n",
      "| epoch 3 |  iter 341 / 351 | time 8[s] | loss 1.48\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 108 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1001\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 648 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 138 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 448 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 848 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1011\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1373\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 868 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 348 \n",
      "---\n",
      "val acc 0.560%\n",
      "| epoch 4 |  iter 1 / 351 | time 0[s] | loss 1.47\n",
      "| epoch 4 |  iter 21 / 351 | time 0[s] | loss 1.46\n",
      "| epoch 4 |  iter 41 / 351 | time 0[s] | loss 1.44\n",
      "| epoch 4 |  iter 61 / 351 | time 1[s] | loss 1.43\n",
      "| epoch 4 |  iter 81 / 351 | time 1[s] | loss 1.42\n",
      "| epoch 4 |  iter 101 / 351 | time 2[s] | loss 1.41\n",
      "| epoch 4 |  iter 121 / 351 | time 2[s] | loss 1.40\n",
      "| epoch 4 |  iter 141 / 351 | time 3[s] | loss 1.40\n",
      "| epoch 4 |  iter 161 / 351 | time 3[s] | loss 1.38\n",
      "| epoch 4 |  iter 181 / 351 | time 4[s] | loss 1.38\n",
      "| epoch 4 |  iter 201 / 351 | time 4[s] | loss 1.37\n",
      "| epoch 4 |  iter 221 / 351 | time 5[s] | loss 1.35\n",
      "| epoch 4 |  iter 241 / 351 | time 5[s] | loss 1.33\n",
      "| epoch 4 |  iter 261 / 351 | time 6[s] | loss 1.33\n",
      "| epoch 4 |  iter 281 / 351 | time 6[s] | loss 1.33\n",
      "| epoch 4 |  iter 301 / 351 | time 7[s] | loss 1.32\n",
      "| epoch 4 |  iter 321 / 351 | time 7[s] | loss 1.31\n",
      "| epoch 4 |  iter 341 / 351 | time 7[s] | loss 1.30\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 146 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1189\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "O 666 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 162 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 432 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 866 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1002\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1406\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 862 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 202 \n",
      "---\n",
      "val acc 1.060%\n",
      "| epoch 5 |  iter 1 / 351 | time 0[s] | loss 1.28\n",
      "| epoch 5 |  iter 21 / 351 | time 0[s] | loss 1.29\n",
      "| epoch 5 |  iter 41 / 351 | time 0[s] | loss 1.28\n",
      "| epoch 5 |  iter 61 / 351 | time 1[s] | loss 1.27\n",
      "| epoch 5 |  iter 81 / 351 | time 1[s] | loss 1.27\n",
      "| epoch 5 |  iter 101 / 351 | time 2[s] | loss 1.26\n",
      "| epoch 5 |  iter 121 / 351 | time 2[s] | loss 1.26\n",
      "| epoch 5 |  iter 141 / 351 | time 3[s] | loss 1.27\n",
      "| epoch 5 |  iter 161 / 351 | time 3[s] | loss 1.26\n",
      "| epoch 5 |  iter 181 / 351 | time 4[s] | loss 1.25\n",
      "| epoch 5 |  iter 201 / 351 | time 4[s] | loss 1.23\n",
      "| epoch 5 |  iter 221 / 351 | time 5[s] | loss 1.22\n",
      "| epoch 5 |  iter 241 / 351 | time 5[s] | loss 1.21\n",
      "| epoch 5 |  iter 261 / 351 | time 6[s] | loss 1.21\n",
      "| epoch 5 |  iter 281 / 351 | time 6[s] | loss 1.21\n",
      "| epoch 5 |  iter 301 / 351 | time 7[s] | loss 1.20\n",
      "| epoch 5 |  iter 321 / 351 | time 7[s] | loss 1.19\n",
      "| epoch 5 |  iter 341 / 351 | time 8[s] | loss 1.18\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 145 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1168\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 665 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 192 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 431 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 895 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1015\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1493\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 891 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 221 \n",
      "---\n",
      "val acc 2.260%\n",
      "| epoch 6 |  iter 1 / 351 | time 0[s] | loss 1.17\n",
      "| epoch 6 |  iter 21 / 351 | time 0[s] | loss 1.17\n",
      "| epoch 6 |  iter 41 / 351 | time 0[s] | loss 1.18\n",
      "| epoch 6 |  iter 61 / 351 | time 1[s] | loss 1.17\n",
      "| epoch 6 |  iter 81 / 351 | time 1[s] | loss 1.16\n",
      "| epoch 6 |  iter 101 / 351 | time 2[s] | loss 1.16\n",
      "| epoch 6 |  iter 121 / 351 | time 2[s] | loss 1.16\n",
      "| epoch 6 |  iter 141 / 351 | time 3[s] | loss 1.14\n",
      "| epoch 6 |  iter 161 / 351 | time 3[s] | loss 1.14\n",
      "| epoch 6 |  iter 181 / 351 | time 4[s] | loss 1.13\n",
      "| epoch 6 |  iter 201 / 351 | time 4[s] | loss 1.16\n",
      "| epoch 6 |  iter 221 / 351 | time 5[s] | loss 1.13\n",
      "| epoch 6 |  iter 241 / 351 | time 5[s] | loss 1.12\n",
      "| epoch 6 |  iter 261 / 351 | time 6[s] | loss 1.13\n",
      "| epoch 6 |  iter 281 / 351 | time 6[s] | loss 1.13\n",
      "| epoch 6 |  iter 301 / 351 | time 7[s] | loss 1.17\n",
      "| epoch 6 |  iter 321 / 351 | time 7[s] | loss 1.14\n",
      "| epoch 6 |  iter 341 / 351 | time 8[s] | loss 1.10\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 166 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1169\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 660 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 174 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 412 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 866 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1011\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1412\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 860 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 207 \n",
      "---\n",
      "val acc 3.400%\n",
      "| epoch 7 |  iter 1 / 351 | time 0[s] | loss 1.10\n",
      "| epoch 7 |  iter 21 / 351 | time 0[s] | loss 1.09\n",
      "| epoch 7 |  iter 41 / 351 | time 0[s] | loss 1.09\n",
      "| epoch 7 |  iter 61 / 351 | time 1[s] | loss 1.11\n",
      "| epoch 7 |  iter 81 / 351 | time 1[s] | loss 1.09\n",
      "| epoch 7 |  iter 101 / 351 | time 2[s] | loss 1.08\n",
      "| epoch 7 |  iter 121 / 351 | time 2[s] | loss 1.08\n",
      "| epoch 7 |  iter 141 / 351 | time 3[s] | loss 1.08\n",
      "| epoch 7 |  iter 161 / 351 | time 3[s] | loss 1.10\n",
      "| epoch 7 |  iter 181 / 351 | time 4[s] | loss 1.07\n",
      "| epoch 7 |  iter 201 / 351 | time 4[s] | loss 1.06\n",
      "| epoch 7 |  iter 221 / 351 | time 5[s] | loss 1.06\n",
      "| epoch 7 |  iter 241 / 351 | time 5[s] | loss 1.06\n",
      "| epoch 7 |  iter 261 / 351 | time 6[s] | loss 1.06\n",
      "| epoch 7 |  iter 281 / 351 | time 6[s] | loss 1.07\n",
      "| epoch 7 |  iter 301 / 351 | time 7[s] | loss 1.07\n",
      "| epoch 7 |  iter 321 / 351 | time 7[s] | loss 1.06\n",
      "| epoch 7 |  iter 341 / 351 | time 8[s] | loss 1.04\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 166 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1160\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 668 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 148 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 418 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "O 857 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1409\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "O 864 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 228 \n",
      "---\n",
      "val acc 4.200%\n",
      "| epoch 8 |  iter 1 / 351 | time 0[s] | loss 1.04\n",
      "| epoch 8 |  iter 21 / 351 | time 0[s] | loss 1.05\n",
      "| epoch 8 |  iter 41 / 351 | time 0[s] | loss 1.05\n",
      "| epoch 8 |  iter 61 / 351 | time 1[s] | loss 1.05\n",
      "| epoch 8 |  iter 81 / 351 | time 1[s] | loss 1.09\n",
      "| epoch 8 |  iter 101 / 351 | time 2[s] | loss 1.04\n",
      "| epoch 8 |  iter 121 / 351 | time 2[s] | loss 1.03\n",
      "| epoch 8 |  iter 141 / 351 | time 3[s] | loss 1.05\n",
      "| epoch 8 |  iter 161 / 351 | time 3[s] | loss 1.04\n",
      "| epoch 8 |  iter 181 / 351 | time 4[s] | loss 1.02\n",
      "| epoch 8 |  iter 201 / 351 | time 4[s] | loss 1.03\n",
      "| epoch 8 |  iter 221 / 351 | time 5[s] | loss 1.02\n",
      "| epoch 8 |  iter 241 / 351 | time 5[s] | loss 1.02\n",
      "| epoch 8 |  iter 261 / 351 | time 6[s] | loss 1.01\n",
      "| epoch 8 |  iter 281 / 351 | time 6[s] | loss 1.02\n",
      "| epoch 8 |  iter 301 / 351 | time 7[s] | loss 1.01\n",
      "| epoch 8 |  iter 321 / 351 | time 7[s] | loss 1.01\n",
      "| epoch 8 |  iter 341 / 351 | time 8[s] | loss 1.01\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 158 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1160\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 661 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 158 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 411 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 836 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1410\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 861 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 226 \n",
      "---\n",
      "val acc 4.400%\n",
      "| epoch 9 |  iter 1 / 351 | time 0[s] | loss 1.00\n",
      "| epoch 9 |  iter 21 / 351 | time 0[s] | loss 1.01\n",
      "| epoch 9 |  iter 41 / 351 | time 0[s] | loss 1.01\n",
      "| epoch 9 |  iter 61 / 351 | time 1[s] | loss 1.00\n",
      "| epoch 9 |  iter 81 / 351 | time 1[s] | loss 1.05\n",
      "| epoch 9 |  iter 101 / 351 | time 2[s] | loss 1.02\n",
      "| epoch 9 |  iter 121 / 351 | time 2[s] | loss 0.99\n",
      "| epoch 9 |  iter 141 / 351 | time 3[s] | loss 1.00\n",
      "| epoch 9 |  iter 161 / 351 | time 3[s] | loss 0.99\n",
      "| epoch 9 |  iter 181 / 351 | time 4[s] | loss 0.99\n",
      "| epoch 9 |  iter 201 / 351 | time 4[s] | loss 1.01\n",
      "| epoch 9 |  iter 221 / 351 | time 5[s] | loss 1.02\n",
      "| epoch 9 |  iter 241 / 351 | time 5[s] | loss 1.01\n",
      "| epoch 9 |  iter 261 / 351 | time 6[s] | loss 0.97\n",
      "| epoch 9 |  iter 281 / 351 | time 6[s] | loss 0.99\n",
      "| epoch 9 |  iter 301 / 351 | time 7[s] | loss 0.98\n",
      "| epoch 9 |  iter 321 / 351 | time 7[s] | loss 0.98\n",
      "| epoch 9 |  iter 341 / 351 | time 8[s] | loss 0.97\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 167 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1128\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 677 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 158 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 418 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 870 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1418\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 857 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 228 \n",
      "---\n",
      "val acc 5.840%\n",
      "| epoch 10 |  iter 1 / 351 | time 0[s] | loss 0.95\n",
      "| epoch 10 |  iter 21 / 351 | time 0[s] | loss 0.97\n",
      "| epoch 10 |  iter 41 / 351 | time 0[s] | loss 0.96\n",
      "| epoch 10 |  iter 61 / 351 | time 1[s] | loss 0.97\n",
      "| epoch 10 |  iter 81 / 351 | time 1[s] | loss 0.96\n",
      "| epoch 10 |  iter 101 / 351 | time 2[s] | loss 0.96\n",
      "| epoch 10 |  iter 121 / 351 | time 2[s] | loss 0.96\n",
      "| epoch 10 |  iter 141 / 351 | time 3[s] | loss 0.97\n",
      "| epoch 10 |  iter 161 / 351 | time 3[s] | loss 0.96\n",
      "| epoch 10 |  iter 181 / 351 | time 4[s] | loss 0.99\n",
      "| epoch 10 |  iter 201 / 351 | time 4[s] | loss 1.05\n",
      "| epoch 10 |  iter 221 / 351 | time 5[s] | loss 1.04\n",
      "| epoch 10 |  iter 241 / 351 | time 5[s] | loss 0.97\n",
      "| epoch 10 |  iter 261 / 351 | time 6[s] | loss 0.95\n",
      "| epoch 10 |  iter 281 / 351 | time 6[s] | loss 0.95\n",
      "| epoch 10 |  iter 301 / 351 | time 7[s] | loss 0.94\n",
      "| epoch 10 |  iter 321 / 351 | time 7[s] | loss 0.94\n",
      "| epoch 10 |  iter 341 / 351 | time 8[s] | loss 0.94\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 160 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1129\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 660 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 160 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 402 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 856 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 861 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 237 \n",
      "---\n",
      "val acc 3.600%\n",
      "| epoch 11 |  iter 1 / 351 | time 0[s] | loss 0.97\n",
      "| epoch 11 |  iter 21 / 351 | time 0[s] | loss 0.95\n",
      "| epoch 11 |  iter 41 / 351 | time 0[s] | loss 0.96\n",
      "| epoch 11 |  iter 61 / 351 | time 1[s] | loss 0.94\n",
      "| epoch 11 |  iter 81 / 351 | time 1[s] | loss 0.95\n",
      "| epoch 11 |  iter 101 / 351 | time 2[s] | loss 0.94\n",
      "| epoch 11 |  iter 121 / 351 | time 2[s] | loss 0.94\n",
      "| epoch 11 |  iter 141 / 351 | time 3[s] | loss 0.93\n",
      "| epoch 11 |  iter 161 / 351 | time 3[s] | loss 0.94\n",
      "| epoch 11 |  iter 181 / 351 | time 4[s] | loss 0.95\n",
      "| epoch 11 |  iter 201 / 351 | time 4[s] | loss 0.93\n",
      "| epoch 11 |  iter 221 / 351 | time 5[s] | loss 0.94\n",
      "| epoch 11 |  iter 241 / 351 | time 5[s] | loss 0.92\n",
      "| epoch 11 |  iter 261 / 351 | time 6[s] | loss 0.94\n",
      "| epoch 11 |  iter 281 / 351 | time 6[s] | loss 0.92\n",
      "| epoch 11 |  iter 301 / 351 | time 7[s] | loss 0.92\n",
      "| epoch 11 |  iter 321 / 351 | time 7[s] | loss 0.93\n",
      "| epoch 11 |  iter 341 / 351 | time 8[s] | loss 0.93\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 161 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1128\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 691 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 172 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 419 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 856 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1071\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1461\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 868 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 228 \n",
      "---\n",
      "val acc 4.920%\n",
      "| epoch 12 |  iter 1 / 351 | time 0[s] | loss 0.96\n",
      "| epoch 12 |  iter 21 / 351 | time 0[s] | loss 0.93\n",
      "| epoch 12 |  iter 41 / 351 | time 0[s] | loss 0.96\n",
      "| epoch 12 |  iter 61 / 351 | time 1[s] | loss 0.96\n",
      "| epoch 12 |  iter 81 / 351 | time 1[s] | loss 0.94\n",
      "| epoch 12 |  iter 101 / 351 | time 2[s] | loss 0.96\n",
      "| epoch 12 |  iter 121 / 351 | time 2[s] | loss 0.95\n",
      "| epoch 12 |  iter 141 / 351 | time 3[s] | loss 0.91\n",
      "| epoch 12 |  iter 161 / 351 | time 3[s] | loss 0.91\n",
      "| epoch 12 |  iter 181 / 351 | time 4[s] | loss 0.92\n",
      "| epoch 12 |  iter 201 / 351 | time 4[s] | loss 0.92\n",
      "| epoch 12 |  iter 221 / 351 | time 5[s] | loss 0.93\n",
      "| epoch 12 |  iter 241 / 351 | time 5[s] | loss 0.95\n",
      "| epoch 12 |  iter 261 / 351 | time 6[s] | loss 0.90\n",
      "| epoch 12 |  iter 281 / 351 | time 6[s] | loss 0.90\n",
      "| epoch 12 |  iter 301 / 351 | time 7[s] | loss 0.92\n",
      "| epoch 12 |  iter 321 / 351 | time 7[s] | loss 0.94\n",
      "| epoch 12 |  iter 341 / 351 | time 8[s] | loss 0.95\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 157 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1126\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 668 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 154 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 412 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 849 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1049\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1404\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 851 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 227 \n",
      "---\n",
      "val acc 3.040%\n",
      "| epoch 13 |  iter 1 / 351 | time 0[s] | loss 0.95\n",
      "| epoch 13 |  iter 21 / 351 | time 0[s] | loss 0.90\n",
      "| epoch 13 |  iter 41 / 351 | time 0[s] | loss 0.89\n",
      "| epoch 13 |  iter 61 / 351 | time 1[s] | loss 0.91\n",
      "| epoch 13 |  iter 81 / 351 | time 1[s] | loss 0.92\n",
      "| epoch 13 |  iter 101 / 351 | time 2[s] | loss 0.91\n",
      "| epoch 13 |  iter 121 / 351 | time 2[s] | loss 0.91\n",
      "| epoch 13 |  iter 141 / 351 | time 3[s] | loss 0.89\n",
      "| epoch 13 |  iter 161 / 351 | time 3[s] | loss 0.92\n",
      "| epoch 13 |  iter 181 / 351 | time 4[s] | loss 0.89\n",
      "| epoch 13 |  iter 201 / 351 | time 4[s] | loss 0.90\n",
      "| epoch 13 |  iter 221 / 351 | time 5[s] | loss 0.88\n",
      "| epoch 13 |  iter 241 / 351 | time 5[s] | loss 0.89\n",
      "| epoch 13 |  iter 261 / 351 | time 6[s] | loss 0.94\n",
      "| epoch 13 |  iter 281 / 351 | time 6[s] | loss 0.89\n",
      "| epoch 13 |  iter 301 / 351 | time 7[s] | loss 0.88\n",
      "| epoch 13 |  iter 321 / 351 | time 7[s] | loss 0.88\n",
      "| epoch 13 |  iter 341 / 351 | time 8[s] | loss 0.88\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 157 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1121\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 659 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 162 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 419 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 846 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1418\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 859 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 239 \n",
      "---\n",
      "val acc 5.760%\n",
      "| epoch 14 |  iter 1 / 351 | time 0[s] | loss 0.92\n",
      "| epoch 14 |  iter 21 / 351 | time 0[s] | loss 0.88\n",
      "| epoch 14 |  iter 41 / 351 | time 0[s] | loss 0.87\n",
      "| epoch 14 |  iter 61 / 351 | time 1[s] | loss 0.88\n",
      "| epoch 14 |  iter 81 / 351 | time 1[s] | loss 0.88\n",
      "| epoch 14 |  iter 101 / 351 | time 2[s] | loss 0.88\n",
      "| epoch 14 |  iter 121 / 351 | time 2[s] | loss 0.92\n",
      "| epoch 14 |  iter 141 / 351 | time 3[s] | loss 0.93\n",
      "| epoch 14 |  iter 161 / 351 | time 3[s] | loss 0.91\n",
      "| epoch 14 |  iter 181 / 351 | time 4[s] | loss 0.90\n",
      "| epoch 14 |  iter 201 / 351 | time 4[s] | loss 0.90\n",
      "| epoch 14 |  iter 221 / 351 | time 5[s] | loss 0.91\n",
      "| epoch 14 |  iter 241 / 351 | time 5[s] | loss 0.90\n",
      "| epoch 14 |  iter 261 / 351 | time 6[s] | loss 0.90\n",
      "| epoch 14 |  iter 281 / 351 | time 6[s] | loss 0.89\n",
      "| epoch 14 |  iter 301 / 351 | time 7[s] | loss 0.87\n",
      "| epoch 14 |  iter 321 / 351 | time 7[s] | loss 0.87\n",
      "| epoch 14 |  iter 341 / 351 | time 8[s] | loss 0.88\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 160 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1160\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 655 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 175 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 412 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 859 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1070\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1418\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 859 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 239 \n",
      "---\n",
      "val acc 5.480%\n",
      "| epoch 15 |  iter 1 / 351 | time 0[s] | loss 0.85\n",
      "| epoch 15 |  iter 21 / 351 | time 0[s] | loss 0.87\n",
      "| epoch 15 |  iter 41 / 351 | time 0[s] | loss 0.90\n",
      "| epoch 15 |  iter 61 / 351 | time 1[s] | loss 0.85\n",
      "| epoch 15 |  iter 81 / 351 | time 1[s] | loss 0.90\n",
      "| epoch 15 |  iter 101 / 351 | time 2[s] | loss 0.91\n",
      "| epoch 15 |  iter 121 / 351 | time 2[s] | loss 0.89\n",
      "| epoch 15 |  iter 141 / 351 | time 3[s] | loss 0.89\n",
      "| epoch 15 |  iter 161 / 351 | time 3[s] | loss 0.88\n",
      "| epoch 15 |  iter 181 / 351 | time 4[s] | loss 0.86\n",
      "| epoch 15 |  iter 201 / 351 | time 4[s] | loss 0.89\n",
      "| epoch 15 |  iter 221 / 351 | time 5[s] | loss 0.92\n",
      "| epoch 15 |  iter 241 / 351 | time 5[s] | loss 0.90\n",
      "| epoch 15 |  iter 261 / 351 | time 6[s] | loss 0.90\n",
      "| epoch 15 |  iter 281 / 351 | time 6[s] | loss 0.90\n",
      "| epoch 15 |  iter 301 / 351 | time 7[s] | loss 0.88\n",
      "| epoch 15 |  iter 321 / 351 | time 7[s] | loss 0.90\n",
      "| epoch 15 |  iter 341 / 351 | time 8[s] | loss 0.91\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 164 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1138\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 662 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 172 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 412 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 849 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 856 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 227 \n",
      "---\n",
      "val acc 3.960%\n",
      "| epoch 16 |  iter 1 / 351 | time 0[s] | loss 0.89\n",
      "| epoch 16 |  iter 21 / 351 | time 0[s] | loss 0.88\n",
      "| epoch 16 |  iter 41 / 351 | time 0[s] | loss 0.86\n",
      "| epoch 16 |  iter 61 / 351 | time 1[s] | loss 0.85\n",
      "| epoch 16 |  iter 81 / 351 | time 1[s] | loss 0.87\n",
      "| epoch 16 |  iter 101 / 351 | time 2[s] | loss 0.87\n",
      "| epoch 16 |  iter 121 / 351 | time 2[s] | loss 0.87\n",
      "| epoch 16 |  iter 141 / 351 | time 3[s] | loss 0.86\n",
      "| epoch 16 |  iter 161 / 351 | time 3[s] | loss 0.85\n",
      "| epoch 16 |  iter 181 / 351 | time 4[s] | loss 0.87\n",
      "| epoch 16 |  iter 201 / 351 | time 4[s] | loss 0.86\n",
      "| epoch 16 |  iter 221 / 351 | time 5[s] | loss 0.96\n",
      "| epoch 16 |  iter 241 / 351 | time 5[s] | loss 0.88\n",
      "| epoch 16 |  iter 261 / 351 | time 6[s] | loss 0.88\n",
      "| epoch 16 |  iter 281 / 351 | time 6[s] | loss 0.87\n",
      "| epoch 16 |  iter 301 / 351 | time 7[s] | loss 0.88\n",
      "| epoch 16 |  iter 321 / 351 | time 7[s] | loss 0.88\n",
      "| epoch 16 |  iter 341 / 351 | time 8[s] | loss 0.87\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 161 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1127\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 662 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 158 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 412 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 846 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1059\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1414\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 859 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 237 \n",
      "---\n",
      "val acc 5.500%\n",
      "| epoch 17 |  iter 1 / 351 | time 0[s] | loss 0.86\n",
      "| epoch 17 |  iter 21 / 351 | time 0[s] | loss 0.88\n",
      "| epoch 17 |  iter 41 / 351 | time 0[s] | loss 0.88\n",
      "| epoch 17 |  iter 61 / 351 | time 1[s] | loss 0.87\n",
      "| epoch 17 |  iter 81 / 351 | time 1[s] | loss 0.84\n",
      "| epoch 17 |  iter 101 / 351 | time 2[s] | loss 0.85\n",
      "| epoch 17 |  iter 121 / 351 | time 2[s] | loss 0.87\n",
      "| epoch 17 |  iter 141 / 351 | time 3[s] | loss 0.88\n",
      "| epoch 17 |  iter 161 / 351 | time 3[s] | loss 0.88\n",
      "| epoch 17 |  iter 181 / 351 | time 4[s] | loss 0.86\n",
      "| epoch 17 |  iter 201 / 351 | time 4[s] | loss 0.84\n",
      "| epoch 17 |  iter 221 / 351 | time 5[s] | loss 0.85\n",
      "| epoch 17 |  iter 241 / 351 | time 5[s] | loss 0.84\n",
      "| epoch 17 |  iter 261 / 351 | time 6[s] | loss 0.85\n",
      "| epoch 17 |  iter 281 / 351 | time 6[s] | loss 0.88\n",
      "| epoch 17 |  iter 301 / 351 | time 7[s] | loss 0.84\n",
      "| epoch 17 |  iter 321 / 351 | time 7[s] | loss 0.85\n",
      "| epoch 17 |  iter 341 / 351 | time 8[s] | loss 0.88\n",
      "Q 77+85  \n",
      "T 162 \n",
      "O 162 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1162\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 667 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 172 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 427 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 859 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1071\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 871 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 249 \n",
      "---\n",
      "val acc 6.080%\n",
      "| epoch 18 |  iter 1 / 351 | time 0[s] | loss 0.85\n",
      "| epoch 18 |  iter 21 / 351 | time 0[s] | loss 0.85\n",
      "| epoch 18 |  iter 41 / 351 | time 0[s] | loss 0.86\n",
      "| epoch 18 |  iter 61 / 351 | time 1[s] | loss 0.85\n",
      "| epoch 18 |  iter 81 / 351 | time 1[s] | loss 0.85\n",
      "| epoch 18 |  iter 101 / 351 | time 2[s] | loss 0.83\n",
      "| epoch 18 |  iter 121 / 351 | time 2[s] | loss 0.88\n",
      "| epoch 18 |  iter 141 / 351 | time 3[s] | loss 0.87\n",
      "| epoch 18 |  iter 161 / 351 | time 3[s] | loss 0.86\n",
      "| epoch 18 |  iter 181 / 351 | time 4[s] | loss 0.86\n",
      "| epoch 18 |  iter 201 / 351 | time 4[s] | loss 0.86\n",
      "| epoch 18 |  iter 221 / 351 | time 5[s] | loss 0.83\n",
      "| epoch 18 |  iter 241 / 351 | time 5[s] | loss 0.83\n",
      "| epoch 18 |  iter 261 / 351 | time 6[s] | loss 0.83\n",
      "| epoch 18 |  iter 281 / 351 | time 6[s] | loss 0.83\n",
      "| epoch 18 |  iter 301 / 351 | time 7[s] | loss 0.82\n",
      "| epoch 18 |  iter 321 / 351 | time 7[s] | loss 0.83\n",
      "| epoch 18 |  iter 341 / 351 | time 8[s] | loss 0.84\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 164 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1136\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 667 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 172 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 427 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 859 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1049\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1418\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 867 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 245 \n",
      "---\n",
      "val acc 8.560%\n",
      "| epoch 19 |  iter 1 / 351 | time 0[s] | loss 0.81\n",
      "| epoch 19 |  iter 21 / 351 | time 0[s] | loss 0.81\n",
      "| epoch 19 |  iter 41 / 351 | time 0[s] | loss 0.84\n",
      "| epoch 19 |  iter 61 / 351 | time 1[s] | loss 0.83\n",
      "| epoch 19 |  iter 81 / 351 | time 1[s] | loss 0.82\n",
      "| epoch 19 |  iter 101 / 351 | time 2[s] | loss 0.83\n",
      "| epoch 19 |  iter 121 / 351 | time 2[s] | loss 0.82\n",
      "| epoch 19 |  iter 141 / 351 | time 3[s] | loss 0.82\n",
      "| epoch 19 |  iter 161 / 351 | time 3[s] | loss 0.83\n",
      "| epoch 19 |  iter 181 / 351 | time 4[s] | loss 0.83\n",
      "| epoch 19 |  iter 201 / 351 | time 4[s] | loss 0.81\n",
      "| epoch 19 |  iter 221 / 351 | time 5[s] | loss 0.89\n",
      "| epoch 19 |  iter 241 / 351 | time 5[s] | loss 0.88\n",
      "| epoch 19 |  iter 261 / 351 | time 6[s] | loss 0.86\n",
      "| epoch 19 |  iter 281 / 351 | time 6[s] | loss 0.84\n",
      "| epoch 19 |  iter 301 / 351 | time 7[s] | loss 0.84\n",
      "| epoch 19 |  iter 321 / 351 | time 7[s] | loss 0.83\n",
      "| epoch 19 |  iter 341 / 351 | time 8[s] | loss 0.84\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 160 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1162\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 672 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 167 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 419 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 856 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1049\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 867 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 237 \n",
      "---\n",
      "val acc 10.460%\n",
      "| epoch 20 |  iter 1 / 351 | time 0[s] | loss 0.79\n",
      "| epoch 20 |  iter 21 / 351 | time 0[s] | loss 0.82\n",
      "| epoch 20 |  iter 41 / 351 | time 0[s] | loss 0.82\n",
      "| epoch 20 |  iter 61 / 351 | time 1[s] | loss 0.82\n",
      "| epoch 20 |  iter 81 / 351 | time 1[s] | loss 0.81\n",
      "| epoch 20 |  iter 101 / 351 | time 2[s] | loss 0.82\n",
      "| epoch 20 |  iter 121 / 351 | time 2[s] | loss 0.84\n",
      "| epoch 20 |  iter 141 / 351 | time 3[s] | loss 0.82\n",
      "| epoch 20 |  iter 161 / 351 | time 3[s] | loss 0.84\n",
      "| epoch 20 |  iter 181 / 351 | time 4[s] | loss 0.85\n",
      "| epoch 20 |  iter 201 / 351 | time 4[s] | loss 0.85\n",
      "| epoch 20 |  iter 221 / 351 | time 5[s] | loss 0.82\n",
      "| epoch 20 |  iter 241 / 351 | time 5[s] | loss 0.81\n",
      "| epoch 20 |  iter 261 / 351 | time 6[s] | loss 0.83\n",
      "| epoch 20 |  iter 281 / 351 | time 6[s] | loss 0.79\n",
      "| epoch 20 |  iter 301 / 351 | time 7[s] | loss 0.80\n",
      "| epoch 20 |  iter 321 / 351 | time 7[s] | loss 0.85\n",
      "| epoch 20 |  iter 341 / 351 | time 8[s] | loss 0.84\n",
      "Q 77+85  \n",
      "T 162 \n",
      "O 162 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1127\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 669 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 159 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 419 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 866 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1049\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 872 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 235 \n",
      "---\n",
      "val acc 9.260%\n",
      "| epoch 21 |  iter 1 / 351 | time 0[s] | loss 0.80\n",
      "| epoch 21 |  iter 21 / 351 | time 0[s] | loss 0.83\n",
      "| epoch 21 |  iter 41 / 351 | time 0[s] | loss 0.82\n",
      "| epoch 21 |  iter 61 / 351 | time 1[s] | loss 0.83\n",
      "| epoch 21 |  iter 81 / 351 | time 1[s] | loss 0.82\n",
      "| epoch 21 |  iter 101 / 351 | time 2[s] | loss 0.82\n",
      "| epoch 21 |  iter 121 / 351 | time 2[s] | loss 0.82\n",
      "| epoch 21 |  iter 141 / 351 | time 3[s] | loss 0.80\n",
      "| epoch 21 |  iter 161 / 351 | time 3[s] | loss 0.81\n",
      "| epoch 21 |  iter 181 / 351 | time 4[s] | loss 0.81\n",
      "| epoch 21 |  iter 201 / 351 | time 4[s] | loss 0.82\n",
      "| epoch 21 |  iter 221 / 351 | time 5[s] | loss 0.82\n",
      "| epoch 21 |  iter 241 / 351 | time 5[s] | loss 0.82\n",
      "| epoch 21 |  iter 261 / 351 | time 6[s] | loss 0.79\n",
      "| epoch 21 |  iter 281 / 351 | time 6[s] | loss 0.80\n",
      "| epoch 21 |  iter 301 / 351 | time 7[s] | loss 0.80\n",
      "| epoch 21 |  iter 321 / 351 | time 7[s] | loss 0.81\n",
      "| epoch 21 |  iter 341 / 351 | time 8[s] | loss 0.80\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 164 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1137\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 670 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 164 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 424 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 849 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "O 1053\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "O 864 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 237 \n",
      "---\n",
      "val acc 9.980%\n",
      "| epoch 22 |  iter 1 / 351 | time 0[s] | loss 0.80\n",
      "| epoch 22 |  iter 21 / 351 | time 0[s] | loss 0.80\n",
      "| epoch 22 |  iter 41 / 351 | time 0[s] | loss 0.80\n",
      "| epoch 22 |  iter 61 / 351 | time 1[s] | loss 0.79\n",
      "| epoch 22 |  iter 81 / 351 | time 1[s] | loss 0.80\n",
      "| epoch 22 |  iter 101 / 351 | time 2[s] | loss 0.80\n",
      "| epoch 22 |  iter 121 / 351 | time 2[s] | loss 0.82\n",
      "| epoch 22 |  iter 141 / 351 | time 3[s] | loss 0.82\n",
      "| epoch 22 |  iter 161 / 351 | time 3[s] | loss 0.80\n",
      "| epoch 22 |  iter 181 / 351 | time 4[s] | loss 0.79\n",
      "| epoch 22 |  iter 201 / 351 | time 4[s] | loss 0.81\n",
      "| epoch 22 |  iter 221 / 351 | time 5[s] | loss 0.82\n",
      "| epoch 22 |  iter 241 / 351 | time 5[s] | loss 0.81\n",
      "| epoch 22 |  iter 261 / 351 | time 6[s] | loss 0.77\n",
      "| epoch 22 |  iter 281 / 351 | time 6[s] | loss 0.80\n",
      "| epoch 22 |  iter 301 / 351 | time 7[s] | loss 0.80\n",
      "| epoch 22 |  iter 321 / 351 | time 7[s] | loss 0.80\n",
      "| epoch 22 |  iter 341 / 351 | time 8[s] | loss 0.80\n",
      "Q 77+85  \n",
      "T 162 \n",
      "O 162 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1127\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 667 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 170 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 432 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 855 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "O 1053\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 867 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 245 \n",
      "---\n",
      "val acc 7.660%\n",
      "| epoch 23 |  iter 1 / 351 | time 0[s] | loss 0.79\n",
      "| epoch 23 |  iter 21 / 351 | time 0[s] | loss 0.84\n",
      "| epoch 23 |  iter 41 / 351 | time 0[s] | loss 0.82\n",
      "| epoch 23 |  iter 61 / 351 | time 1[s] | loss 0.81\n",
      "| epoch 23 |  iter 81 / 351 | time 1[s] | loss 0.80\n",
      "| epoch 23 |  iter 101 / 351 | time 2[s] | loss 0.81\n",
      "| epoch 23 |  iter 121 / 351 | time 2[s] | loss 0.78\n",
      "| epoch 23 |  iter 141 / 351 | time 3[s] | loss 0.77\n",
      "| epoch 23 |  iter 161 / 351 | time 3[s] | loss 0.82\n",
      "| epoch 23 |  iter 181 / 351 | time 4[s] | loss 0.82\n",
      "| epoch 23 |  iter 201 / 351 | time 4[s] | loss 0.80\n",
      "| epoch 23 |  iter 221 / 351 | time 5[s] | loss 0.79\n",
      "| epoch 23 |  iter 241 / 351 | time 5[s] | loss 0.81\n",
      "| epoch 23 |  iter 261 / 351 | time 6[s] | loss 0.77\n",
      "| epoch 23 |  iter 281 / 351 | time 6[s] | loss 0.79\n",
      "| epoch 23 |  iter 301 / 351 | time 7[s] | loss 0.81\n",
      "| epoch 23 |  iter 321 / 351 | time 7[s] | loss 0.78\n",
      "| epoch 23 |  iter 341 / 351 | time 8[s] | loss 0.83\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 160 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1131\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "O 666 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 160 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 415 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 856 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1039\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1410\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 861 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 235 \n",
      "---\n",
      "val acc 9.780%\n",
      "| epoch 24 |  iter 1 / 351 | time 0[s] | loss 0.74\n",
      "| epoch 24 |  iter 21 / 351 | time 0[s] | loss 0.77\n",
      "| epoch 24 |  iter 41 / 351 | time 0[s] | loss 0.77\n",
      "| epoch 24 |  iter 61 / 351 | time 1[s] | loss 0.78\n",
      "| epoch 24 |  iter 81 / 351 | time 1[s] | loss 0.79\n",
      "| epoch 24 |  iter 101 / 351 | time 2[s] | loss 0.78\n",
      "| epoch 24 |  iter 121 / 351 | time 2[s] | loss 0.80\n",
      "| epoch 24 |  iter 141 / 351 | time 3[s] | loss 0.77\n",
      "| epoch 24 |  iter 161 / 351 | time 3[s] | loss 0.78\n",
      "| epoch 24 |  iter 181 / 351 | time 4[s] | loss 0.81\n",
      "| epoch 24 |  iter 201 / 351 | time 4[s] | loss 0.78\n",
      "| epoch 24 |  iter 221 / 351 | time 5[s] | loss 0.78\n",
      "| epoch 24 |  iter 241 / 351 | time 5[s] | loss 0.79\n",
      "| epoch 24 |  iter 261 / 351 | time 6[s] | loss 0.77\n",
      "| epoch 24 |  iter 281 / 351 | time 6[s] | loss 0.78\n",
      "| epoch 24 |  iter 301 / 351 | time 7[s] | loss 0.76\n",
      "| epoch 24 |  iter 321 / 351 | time 7[s] | loss 0.78\n",
      "| epoch 24 |  iter 341 / 351 | time 8[s] | loss 0.84\n",
      "Q 77+85  \n",
      "T 162 \n",
      "X 161 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "X 1150\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 665 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "X 162 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 417 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 851 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1062\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 867 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 235 \n",
      "---\n",
      "val acc 7.520%\n",
      "| epoch 25 |  iter 1 / 351 | time 0[s] | loss 0.74\n",
      "| epoch 25 |  iter 21 / 351 | time 0[s] | loss 0.76\n",
      "| epoch 25 |  iter 41 / 351 | time 0[s] | loss 0.76\n",
      "| epoch 25 |  iter 61 / 351 | time 1[s] | loss 0.77\n",
      "| epoch 25 |  iter 81 / 351 | time 1[s] | loss 0.83\n",
      "| epoch 25 |  iter 101 / 351 | time 2[s] | loss 0.79\n",
      "| epoch 25 |  iter 121 / 351 | time 2[s] | loss 0.76\n",
      "| epoch 25 |  iter 141 / 351 | time 3[s] | loss 0.77\n",
      "| epoch 25 |  iter 161 / 351 | time 3[s] | loss 0.75\n",
      "| epoch 25 |  iter 181 / 351 | time 4[s] | loss 0.76\n",
      "| epoch 25 |  iter 201 / 351 | time 4[s] | loss 0.76\n",
      "| epoch 25 |  iter 221 / 351 | time 5[s] | loss 0.78\n",
      "| epoch 25 |  iter 241 / 351 | time 5[s] | loss 0.78\n",
      "| epoch 25 |  iter 261 / 351 | time 6[s] | loss 0.79\n",
      "| epoch 25 |  iter 281 / 351 | time 6[s] | loss 0.76\n",
      "| epoch 25 |  iter 301 / 351 | time 7[s] | loss 0.77\n",
      "| epoch 25 |  iter 321 / 351 | time 7[s] | loss 0.77\n",
      "| epoch 25 |  iter 341 / 351 | time 8[s] | loss 0.76\n",
      "Q 77+85  \n",
      "T 162 \n",
      "O 162 \n",
      "---\n",
      "Q 975+164\n",
      "T 1139\n",
      "O 1139\n",
      "---\n",
      "Q 582+84 \n",
      "T 666 \n",
      "X 667 \n",
      "---\n",
      "Q 8+155  \n",
      "T 163 \n",
      "O 163 \n",
      "---\n",
      "Q 367+55 \n",
      "T 422 \n",
      "X 429 \n",
      "---\n",
      "Q 600+257\n",
      "T 857 \n",
      "X 859 \n",
      "---\n",
      "Q 761+292\n",
      "T 1053\n",
      "X 1059\n",
      "---\n",
      "Q 830+597\n",
      "T 1427\n",
      "X 1424\n",
      "---\n",
      "Q 26+838 \n",
      "T 864 \n",
      "X 861 \n",
      "---\n",
      "Q 143+93 \n",
      "T 236 \n",
      "X 242 \n",
      "---\n",
      "val acc 10.380%\n"
     ]
    }
   ],
   "source": [
    "acc_list = []\n",
    "for epoch in range(max_epoch):\n",
    "    trainer.fit(x_train, t_train, max_epoch=1,\n",
    "                batch_size=batch_size, max_grad=max_grad)\n",
    "\n",
    "    correct_num = 0\n",
    "    for i in range(len(x_test)):\n",
    "        question, correct = x_test[[i]], t_test[[i]]\n",
    "        verbose = i < 10\n",
    "        correct_num += eval_seq2seq(model, question, correct, id_to_char, verbose)\n",
    "    acc = float(correct_num) / len(x_test)\n",
    "    acc_list.append(acc)\n",
    "    print('val acc %.3f%%' % (acc * 100))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-05-09T17:00:42.349556400Z",
     "start_time": "2023-05-09T16:54:11.006746400Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "\"\"\"\n",
    "eval_seq2seq(model, question, correct, id_to_char, verbose, is_reverse)方法有 6 个参数。首先是模型 model、问题（字符 ID 数组）question、正确解（字符 ID 列表）correct。之后是进行字符 ID与字符映射的字典 id_to_char、指定是否显示结果的 verbose、指定是否反转输入语句的 is_reverse。如果设置 verbose = True，则结果会显示在终端上。\n",
    "\"\"\""
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
